package script.grammar.expression;

import script.grammar.symbol.Type;

public abstract class UnaryOperator implements Operator {
	@Override
	public int getArity() {
		return 1;
	}
	
	@Override
	public Type computeType(Type... operands) {
		if (operands.length != 1) {
			throw new IllegalArgumentException();
		}
		return computeTypeImpl(operands[0]);
	}
	
	protected abstract Type computeTypeImpl(Type operand);
}
